<%@page import="com.wuye.entity.Users"%>
<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <base href="<%=basePath%>">
    <title></title>
	<meta http-equiv="pragma" content="no-cache">
	<meta http-equiv="cache-control" content="no-cache">
	<meta http-equiv="expires" content="0">    
  </head>
  <body>
  	<jsp:include page="driver.jsp"></jsp:include>
    <div id="tool">
				<div style="margin: 10px;">
					<a href="#" class="easyui-linkbutton" data-options="iconCls:'icon-tip',plain:true" onclick="edit()">已维修</a>
					<a href="#" class="easyui-linkbutton" data-options="iconCls:'icon-search',plain:true" onclick="$('#search').dialog('open');">查询</a>
					<a href="#" class="easyui-linkbutton" data-options="iconCls:'icon-reload',plain:true" onclick="window.location.href='wx.jsp'">刷新</a>
					<a href="#" class="easyui-linkbutton" data-options="iconCls:'icon-help',plain:true">帮助</a>
					<a href="#" class="easyui-linkbutton" data-options="iconCls:'icon-redo',plain:true" style="color: green;margin-left: 50px;">提示信息：${msg }</a>
				</div>
			</div>
			<!-- table -->
			<table id="tb" class="easyui-datagrid">
			</table>
  </body>
  <script type="text/javascript">
  	//table
  	$("#tb").datagrid({
		url:'weixiu/allList.do',
		columns:[
			         [   
				         {field:'check',checkbox:true,rowspan:2},   
				         {field:'shijian',title:'最后日期',rowspan:2,width:200,align:'center'},   
				         {field:'neirong',title:'内容',width:600},
				         {field:'username',title:'申请人',width:200,align:'center'}
			      	]
		        ],
		border:false,
		striped: true,
		fit: true,
		rownumbers:true,
		ctrlSelect:true,
		pagination:true,
		toolbar: "#tool"
	});
  	//check选中数id
  	function checkId(){
		var ids = [];
		var rows = $('#tb').datagrid('getSelections');
		for(var i=0; i<rows.length; i++){
			ids.push(rows[i].id);
		}
		return ids;
	}
  //check选中数
  	function check(){
		var ids = [];
		var rows = $('#tb').datagrid('getSelections');
		for(var i=0; i<rows.length; i++){
			ids.push(rows[i]);
		}
		return ids;
	}
  	//edit
  	function edit(){
  		if(check().length>0){
	  		window.location.href="weixiu/update.do?str="+checkId();
  		}
  	}
  	//search
  	function sousuo(){
  		var address='weixiu/searchList.do?type='+$("#type").val()+'&shijian1='+$("#shijian1").datebox('getValue')+'&shijian2='+$("#shijian2").datebox('getValue');
  		$("#tb").datagrid({
  			url:address
  		});
  		$('#search').dialog('close');
  	}
  </script>
  	<!--新增  -->
  	<!-- 查询 -->
  	<div id="search" class="easyui-dialog" title="查询" data-options="iconCls:'icon-tip',closed:true,modal:true" style="width:480px;height:320px;padding:10px">
		<div align="center">
			<table cellpadding="5" style="color:blueviolet;margin-top: 40px;">
				<tr>
					<td>状态:</td>
					<td>
						<select id="type" style="width: 150">
							<option value="2">全部</option>
							<option value="1">已维修</option>
							<option value="0">未维修</option>
						</select>
					</td>
				</tr>
				<tr>
					<td>起始时间</td>
					<td><input id="shijian1" name="shijian1" class="easyui-datebox textbox" type="text" name="birthday" data-options="required:true,editable:false"></input></td>
				</tr>
				<tr>
					<td>结束时间</td>
					<td><input id="shijian2" name="shijian2" class="easyui-datebox textbox" type="text" name="birthday" data-options="required:true,editable:false"></input></td>
				</tr>
			</table>
			<div align="center">
				<a href="#" class="easyui-linkbutton" onclick="sousuo()" data-options="iconCls:'icon-ok'" style="margin-right: 80px;margin-top: 20px;">确定</a>
				<a href="#" class="easyui-linkbutton" onclick="$('#search').dialog('close')" data-options="iconCls:'icon-cancel'" style="margin-top: 20px;">取消</a>
			</div>
		</div>
	 </div>
</html>
